#ifndef DUNGEON_HH
#define DUNGEON_HH

#include <vector>
#include <string>
#include <memory>
#include "Talent.hh"
#include "Equipment.hh"
#include "ShopItem.hh"
#include "Room.hh"

class Character;

class Dungeon {
public:
    // 1. Default constructor (optional, useful if you want to allow Dungeon d;)
    Dungeon() = default;

    // Main constructor
    Dungeon(int numLayers, int roomsPerLayer, Character* p);

    // 2. Copy constructor deleted — copying is not allowed
    Dungeon(const Dungeon&) = delete;

    // 3. Copy assignment operator deleted — assignment by copy is not allowed
    Dungeon& operator=(const Dungeon&) = delete;

    // Move constructor enabled
    Dungeon(Dungeon&& other) noexcept = default;

    // Move assignment operator enabled
    Dungeon& operator=(Dungeon&& other) noexcept = default;

    // 4. Virtual destructor (important if class will be inherited)
    virtual ~Dungeon() = default;

    void explore();

private:
    void generateDungeon(int numLayers, int roomsPerLayer);
    void printDungeon() const;
    std::unique_ptr<Character> createEnemyForRoom(RoomType type, int& baseGoldDrop, int layer);
    std::unique_ptr<Equipment> createEquipmentDrop(RoomType type, bool isBossDefeated = false);
    bool isLayerExplored(int layerIndex) const;
    bool fight(Character& player, std::unique_ptr<Character> enemy, int baseGoldDrop);
    void selectTalent(Character& player, int layer);
    void displayShop(Character& player);
    void displayDungeonMap(int layerIndex, int currentRoomId) const;

    Character* player = nullptr;
    int numLayers = 0;
    int currentLayer = 0; // Tracks the current dungeon layer
    std::vector<std::vector<Room>> layers;
    int gold = 0;
};

#endif // DUNGEON_HH